home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / Mesa / src-glut / glutInit.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-02  |  2.6 KB  |  127 lines

  1. /*
  2.  * Amiga GLUT graphics library toolkit
  3.  * Version:  1.1
  4.  * Copyright (C) 1998 Jarno van der Linden
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Library General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * This library is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  * Library General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Library General Public
  17.  * License along with this library; if not, write to the Free
  18.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  */
  20.  
  21.  
  22. /*
  23.  * glutInit.c
  24.  *
  25.  * Version 1.0  27 Jun 1998
  26.  * by Jarno van der Linden
  27.  * jarno@kcbbs.gen.nz
  28.  *
  29.  * Version 1.1  02 Aug 1998
  30.  * by Jarno van der Linden
  31.  * jarno@kcbbs.gen.nz
  32.  *
  33.  * - Added quantizer plugin arguments
  34.  *
  35.  */
  36.  
  37. #include <proto/intuition.h>
  38.  
  39. #include <string.h>
  40.  
  41. #include "glutstuff.h"
  42.  
  43.  
  44. int Limit(int v, int minv,int maxv)
  45. {
  46.     if(v < minv)
  47.         return(minv);
  48.     if(v > maxv)
  49.         return(maxv);
  50.  
  51.     return(v);
  52. }
  53.  
  54.  
  55. void RemoveArg( int n, int *argc, char **argv)
  56. {
  57.     int t;
  58.     char *p;
  59.  
  60.     p = argv[n];
  61.  
  62.     for(t=n; t<((*argc)-1); t++)
  63.     {
  64.         argv[t] = argv[t+1];
  65.     }
  66.     argv[(*argc)-1] = p;
  67.     (*argc)--;
  68. }
  69.  
  70.  
  71. void glutInit( int *argcp, char **argv)
  72. {
  73.     int t;
  74.  
  75.     CurrentTime(&(glutstuff.basetime_secs),&(glutstuff.basetime_micros));
  76.     glutstuff.havebasetime = TRUE;
  77.  
  78.     for(t=(*argcp)-1; t>=1; t--)
  79.     {
  80.         if((!stricmp(argv[t],"-numcolours")) || (!stricmp(argv[t],"-numcolors")))
  81.         {
  82.             if(t < ((*argcp)-1))
  83.             {
  84.                 glutstuff.numcolours = Limit(atoi(argv[t+1]),2,256);
  85.                 RemoveArg(t,argcp,argv);
  86.                 RemoveArg(t,argcp,argv);
  87.             }
  88.         }
  89.         else if((!stricmp(argv[t],"-colourbase")) || (!stricmp(argv[t],"-colorbase")))
  90.         {
  91.             if(t < ((*argcp)-1))
  92.             {
  93.                 glutstuff.colourbase = Limit(atoi(argv[t+1]),0,254);
  94.                 RemoveArg(t,argcp,argv);
  95.                 RemoveArg(t,argcp,argv);
  96.             }
  97.         }
  98.         else if(!stricmp(argv[t],"-pubscreen"))
  99.         {
  100.             if(t < ((*argcp)-1))
  101.             {
  102.                 glutstuff.pubscreenname = argv[t+1];
  103.                 RemoveArg(t,argcp,argv);
  104.                 RemoveArg(t,argcp,argv);
  105.             }
  106.         }
  107.         else if(!stricmp(argv[t],"-quantizer"))
  108.         {
  109.             if(t < ((*argcp)-1))
  110.             {
  111.                 glutstuff.quantizer = argv[t+1];
  112.                 RemoveArg(t,argcp,argv);
  113.                 RemoveArg(t,argcp,argv);
  114.             }
  115.         }
  116.         else if(!stricmp(argv[t],"-quantizerversion"))
  117.         {
  118.             if(t < ((*argcp)-1))
  119.             {
  120.                 glutstuff.quantizerversion = atol(argv[t+1]);
  121.                 RemoveArg(t,argcp,argv);
  122.                 RemoveArg(t,argcp,argv);
  123.             }
  124.         }
  125.     }
  126. }
  127.